﻿<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="resources" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	
	<xsd:element name="Resources">
		<xsd:complexType>
			<xsd:choice minOccurs="0" maxOccurs="unbounded">
				<!-- SPRITES -->
				<xsd:element name="Sprites">
					<xsd:complexType>
						<xsd:choice maxOccurs="unbounded">
							<xsd:element name="AtlasTexture" type="atlasTextureType" minOccurs="0" maxOccurs="unbounded"/>
							<xsd:element name="Texture" type="textureType" minOccurs="0" maxOccurs="unbounded"/>
						</xsd:choice>
						<xsd:attribute name="BaseDir" use="optional" type="path"/>
					</xsd:complexType>
				</xsd:element>

				<!-- SPRITE COLLECTIONS -->
				<xsd:element name="SpriteCollections">
					<xsd:complexType>
						<xsd:choice minOccurs="0" maxOccurs="unbounded">
							<xsd:element name="List" type="spriteListType" minOccurs="0" maxOccurs="unbounded" />
							<xsd:element name="Grid" type="spriteGridType" minOccurs="0" maxOccurs="unbounded" />
						</xsd:choice>
					</xsd:complexType>
				</xsd:element>
				
				<!-- FONTS -->
				<xsd:element name="Fonts">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="Font" type="fontType" minOccurs="1" maxOccurs="unbounded"/>
						</xsd:sequence>
						<xsd:attribute name="BaseDir" use="optional" type="path"/>
					</xsd:complexType>
				</xsd:element>
				
				<!-- CURSORS -->
				<xsd:element name="Cursors">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="Cursor" type="cursorType" minOccurs="0" maxOccurs="unbounded"/>
						</xsd:sequence>
						<xsd:attribute name="BaseDir" use="optional" type="path"/>
					</xsd:complexType>
				</xsd:element>

				<!-- SHADERS -->
				<xsd:element name="Shaders">
					<xsd:complexType>
						<xsd:choice minOccurs="0" maxOccurs="unbounded">
							<xsd:element name="PixelShader" type="psType" minOccurs="0" maxOccurs="unbounded"/>
							<xsd:element name="VertexShader" type="vsType" minOccurs="0" maxOccurs="unbounded"/>
						</xsd:choice>
						<xsd:attribute name="BaseDir" use="optional" type="path"/>
					</xsd:complexType>
				</xsd:element>
				
				<!-- PARTICLE EFFECTS -->
				<xsd:element name="ParticleEffects">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="Effect" type="particleEffectType" minOccurs="0" maxOccurs="unbounded"/>
						</xsd:sequence>
						<xsd:attribute name="BaseDir" use="optional" type="path"/>
					</xsd:complexType>
				</xsd:element>
			</xsd:choice>
		</xsd:complexType>
	</xsd:element>
	


	<xsd:complexType name="atlasTextureType" >
		<xsd:sequence>
			<xsd:element name="Image" type="imageType" minOccurs="1" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="Border" use="optional" type="xsd:boolean"/>
		<xsd:attribute name="Format" use="optional" type="xsd:string"/>
		<xsd:attribute name="Filter" use="optional" type="xsd:string"/>
	</xsd:complexType>

	<xsd:complexType name="textureType">
		<xsd:sequence>
			<xsd:element name="Image" type="imageType" minOccurs="1" maxOccurs="1"/>
		</xsd:sequence>
		<xsd:attribute name="Format" use="optional" type="xsd:string"/>
		<xsd:attribute name="Filter" use="optional" type="xsd:string"/>
	</xsd:complexType>

	<xsd:complexType name="imageType">
		<xsd:sequence>
			<xsd:element name="Region" type="regionType" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="Name" use="optional" type="xsd:ID"/>
		<xsd:attribute name="File" use="required" type="path"/>
		<xsd:attribute name="OriginX" use="optional" type="xsd:int"/>
		<xsd:attribute name="OriginY" use="optional" type="xsd:int"/>
	</xsd:complexType>

	<xsd:complexType name="regionType">
		<xsd:attribute name="Name" use="required" type="xsd:ID"/>
		<xsd:attribute name="X" use="required" type="xsd:int"/>
		<xsd:attribute name="Y" use="required" type="xsd:int"/>
		<xsd:attribute name="Width" use="required" type="xsd:int"/>
		<xsd:attribute name="Height" use="required" type="xsd:int"/>
		<xsd:attribute name="OriginX" use="optional" type="xsd:int"/>
		<xsd:attribute name="OriginY" use="optional" type="xsd:int"/>
	</xsd:complexType>

	<xsd:complexType name="spriteListType">
		<xsd:sequence>
			<xsd:element name="Item" type="spriteListItemType" minOccurs="1" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attribute name="Name" use="required" type="xsd:ID"/>
	</xsd:complexType>

	<xsd:complexType name="spriteListItemType">
		<xsd:attribute name="Ref" use="required" type="xsd:IDREF"/>
	</xsd:complexType>

	<xsd:complexType name="spriteGridType">
		<xsd:attribute name="Name" use="required" type="xsd:ID"/>
		<xsd:attribute name="Width" use="required" type="xsd:positiveInteger"/>
		<xsd:attribute name="Height" use="required" type="xsd:positiveInteger"/>
		<xsd:attribute name="SourceRef" use="required" type="xsd:IDREF"/>
	</xsd:complexType>

	<xsd:complexType name="fontType">
		<xsd:attribute name="Name" use="required" type="xsd:string"/>
		<xsd:attribute name="Glyphs" use="optional" type="xsd:IDREF" />
	</xsd:complexType>

	<xsd:complexType name="cursorType">
		<xsd:attribute name="Name" use="optional" type="xsd:ID"/>
		<xsd:attribute name="SpriteRef" use="optional" type="xsd:IDREF" />
		<xsd:attribute name="SystemName" use="optional" type="xsd:normalizedString"/>
		<xsd:attribute name="File" use="optional" type="path"/>
	</xsd:complexType>

	<xsd:complexType name="vsType">
		<xsd:attribute name="Name" use="required" type="xsd:string"/>
		<xsd:attribute name="File" use="required" type="path" />
		<xsd:attribute name="Profile" use="optional" type="vsProfile" />
		<xsd:attribute name="EntryPoint" use="optional" type="xsd:normalizedString" />
	</xsd:complexType>

	<xsd:complexType name="psType">
		<xsd:attribute name="Name" use="required" type="xsd:string"/>
		<xsd:attribute name="File" use="required" type="path" />
		<xsd:attribute name="Profile" use="optional" type="psProfile" />
		<xsd:attribute name="EntryPoint" use="optional" type="xsd:normalizedString" />
	</xsd:complexType>

	<xsd:complexType name="particleEffectType">
		<xsd:attribute name="Name" use="required" type="xsd:string"/>
		<xsd:attribute name="File" use="required" type="path" />
		<xsd:attribute name="SpriteRef" use="optional" type="xsd:IDREF" />
	</xsd:complexType>
	
	<!-- Simple Types -->

	<xsd:simpleType name="path">
		<xsd:restriction base="xsd:normalizedString">
			<!--<xsd:pattern value=""/>-->
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="psProfile">
		<xsd:restriction base="xsd:normalizedString">
			<xsd:enumeration value="1.0"/>
			<xsd:enumeration value="1.4"/>
			<xsd:enumeration value="2.0"/>
			<xsd:enumeration value="3.0"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name="vsProfile">
		<xsd:restriction base="xsd:normalizedString">
			<xsd:enumeration value="1.1"/>
			<xsd:enumeration value="2.0"/>
			<xsd:enumeration value="3.0"/>
		</xsd:restriction>
	</xsd:simpleType>

</xsd:schema>
